package com.hzjiteng.newsbymvp.images.presenter;


import com.hzjiteng.newsbymvp.bean.ImageBean;
import com.hzjiteng.newsbymvp.images.model.ImageModeImpl;
import com.hzjiteng.newsbymvp.images.model.ImageModel;
import com.hzjiteng.newsbymvp.images.view.ImageView;

import java.util.List;

/**
 * @author Administrator
 * @created_time 2016072616:52
 */
public class ImagePresenterImpl implements ImagePresenter,ImageModeImpl.OnLoadImageListener {


    private ImageModel imageModel;
    private ImageView imageView;

    public ImagePresenterImpl(ImageView imageView) {
        this.imageModel = new ImageModeImpl();
        this.imageView = imageView;
    }

    @Override
    public void loadImageList() {
        imageView.showProgerss();
        imageModel.loadImageList(this);
    }

    @Override
    public void onSuccess(List<ImageBean> list) {
        imageView.hideProgress();
        imageView.addImges(list);
    }

    @Override
    public void onFailure(String msg, Exception e) {
        imageView.hideProgress();
        imageView.showLoadFailMsg();
    }
}
